export const formatMenus = (data, pid = 0) => {
    function tree(pid) {
      let arr = [];
      data
        .filter((item) => item.parentid == pid)
        .forEach((item) => {
          const obj = {
            name: item.menuname,
            path: item.url,
            menuid: item.menuid,
            meta: {
              title: item.name,
              icon: item.icon,
            },
            children: tree(item.menuid),
          };
          arr.push(obj);
        });
  
      return arr;
    }
    return tree(pid);
  };
  
